package com.demo.java.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.demo.java.entity.User;
import com.demo.java.mapper.UserMapper;
import com.demo.java.service.UserService;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserMapper mapper;
    
    @Override
    public List<User> findByUsers() {
    	QueryWrapper<User> queryWrapper = new QueryWrapper<User>();
    	queryWrapper.orderByAsc("id");
        return mapper.selectList(queryWrapper);
    }

    @Override
    public int insertUser(User entity) {
        return mapper.insert(entity);
    }

    @Override
    public User getById(Integer id) {
        return mapper.selectById(id);
    }
}
